#include <iostream>
#include <string>
#include <vector>
#include <fstream>

#include "Mx.h"



using namespace std;

int main()
{
    vector<string> TR;
    int NTR ;
    vector<string> VT;
    int NVT;
    vector<string> CARSPE;
    vector<int> C;
    vector<vector<int> > CODE, NUM, TACHE;
    int ERR = 0;
    string ligne;
    //int CNTR;



    ifstream lecflux;   //Un flux permettant de lire un fichier

    NTR = 5;
    //lecture de BNF
    lecflux.open("BNF.txt"); //Ouverture du fichier

    if(lecflux)
    {
        for (int i=0; i<NTR; ++i)
        {
            getline(lecflux, ligne);
            TR.push_back(ligne);
        }
    }

    lecflux.close();

    //lecture de CARSPE
    lecflux.open("CARSPE.txt");

    if(lecflux)
    {
        for (int i=0; i<12; ++i)
        {
            getline(lecflux, ligne);
            CARSPE.push_back(ligne);
        }
    }

    lecflux.close();


    M0(TR,
       NTR,
       VT,
       NVT,
       CARSPE,
       C,
       CODE,
       NUM,
       TACHE,
       ERR);

/*
    for (int i=0; i<NTR; ++i)
    {
        cout << "CODE ";
        for (int j=0; j<C[i]; ++j)
        {
            cout << CODE[i][j] << " ";
        }
        cout << endl;
        cout << "NUM  ";
        for (int j=0; j<C[i]; ++j)
        {
            cout << NUM[i][j] << " ";
        }
        cout << endl;
    }
//*/

/*
    for (int i=0; i<NVT+1; ++i)
    {
        cout << "VT " << VT[i] << endl;
    }

    for (int i=0; i<NTR; ++i)
    {
        cout << "VNT " << VNT[i] << endl;
    }

    for (int i=0; i<NTR; ++i)
    {
        cout << "UTI " << UTI[i] << endl;
    }
//*/

/*
    CNTR=NTR;
    for (int i=0; i<CNTR; ++i)
    {
        R123(i, CODE, NUM, TACHE, C, NTR);
        cout << "CODE ";
        for (int j=0; j<C[i]; ++j)
        {
            cout << CODE[i][j] << " ";
        }
        cout << endl;
    }
//*/

    //R123(3, CODE, NUM, TACHE, C, NTR);

    return 0;
}
